package com.net.model;

import java.util.Date;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name="sell_main")
public class SellMain {

	private int id;
	private int typeCount;
	private int totalMoney;
	private String settlementMethod;
	private Date time;
	private char inspectionState;
	private Customer customer;
	private String agent;
	private Set<SellDetail> sellDetain;
	
	public SellMain() {
		
	}
	@Id
	@Column(name="sell_main_id")
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	@Column(name="type_count")
	public int getTypeCount() {
		return typeCount;
	}
	public void setTypeCount(int typeCount) {
		this.typeCount = typeCount;
	}
	@Column(name="total_money")
	public int getTotalMoney() {
		return totalMoney;
	}
	public void setTotalMoney(int totalMoney) {
		this.totalMoney = totalMoney;
	}
	@Column(name="settlement_method")
	public String getSettlementMethod() {
		return settlementMethod;
	}
	public void setSettlementMethod(String settlementMethod) {
		this.settlementMethod = settlementMethod;
	}
	public Date getTime() {
		return time;
	}
	public void setTime(Date time) {
		this.time = time;
	}
	@Column(name="inspection_state")
	public char getInspectionState() {
		return inspectionState;
	}
	public void setInspectionState(char inspectionState) {
		this.inspectionState = inspectionState;
	}
	@ManyToOne(cascade={CascadeType.ALL},fetch=FetchType.EAGER)
	@JoinColumn(name="customer_id")
	public Customer getCustomer() {
		return customer;
	}
	public void setCustomer(Customer customer) {
		this.customer = customer;
	}
	public String getAgent() {
		return agent;
	}
	public void setAgent(String agent) {
		this.agent = agent;
	}
	@OneToMany(mappedBy="sellMain")
	public Set<SellDetail> getSellDetain() {
		return sellDetain;
	}
	public void setSellDetain(Set<SellDetail> sellDetain) {
		this.sellDetain = sellDetain;
	}
}
